package com.ai.platform.system.web;

import com.ai.platform.core.annotation.AIController;
import com.ai.platform.core.annotation.RestInvokeService;
import com.ai.platform.core.controller.BaseController;
import com.ai.platform.model.dto.Output;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Auther: yeyingsheng
 * @Date: 2018/5/28 20:11
 * @Description:权限资源管理
 */
@AIController
@RequestMapping("/system/permission")
public class PermissionController extends BaseController{

    private final Logger logger = LoggerFactory.getLogger(PermissionController.class);

    /**
     * 权限资源管理
     * @return
     */
    @GetMapping(value = "/permission")
    @RequiresPermissions("permission::permission")
    public String toPermission(){
        return "system/permission/permission";
    }

    /**
     * 权限资源管理[列表] 分页查询权限
     * @return
     */
    @RequestMapping(value = "/permissionList")
    @RequiresPermissions("permission::list")
    @RestInvokeService(serviceName = "sysPermissionServiceImpl",method = "listPermission")
    public Output listPermission(){
        return super.getOutput();
    }


    /**
     * 权限资源管理[列表] 查询所有权限
     * @return
     */
    @RequestMapping(value = "/permissionListAll")
    @RequiresPermissions("Permission::list")
    @RestInvokeService(serviceName = "sysPermissionServiceImpl",method = "listPermissionAll")
    public Output listPermissionAll(){
        return super.getOutput();
    }
    /**
     * 权限资源管理[保存]
     * @return
     */
    @PostMapping(value = "/savePermission")
    @RequiresPermissions("Permission::save")
    @RestInvokeService(serviceName = "sysPermissionServiceImpl",method = "savePermission")
    public Output savePermission(){
        return super.getOutput();
    }

    /**
     * 权限资源管理[修改]
     * @return
     */
    @PostMapping(value = "/updatePermission")
    @RequiresPermissions("permission::update")
    @RestInvokeService(serviceName = "sysPermissionServiceImpl",method = "updatePermission")
    public Output updatePermission(){
        return super.getOutput();
    }

    /**
     * 权限资源管理[删除]
     * @return
     */
    @PostMapping(value = "/deletePermission")
    @RequiresPermissions("permission::delete")
    @RestInvokeService(serviceName = "sysPermissionServiceImpl",method = "deletePermission")
    public Output deletePermission(){
        return super.getOutput();
    }

}
